package com.lz.controller;

import com.lz.common.LzException;
import com.lz.common.Result;
import com.lz.service.UserServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <pre>
 * @描述：
 * @作者：lizhao
 * @创建时间： 2024/8/21 上午8:55
 * </pre>
 **/
@RequestMapping
@RestController
@RequiredArgsConstructor
public class UserController {

    private final UserServiceImpl userService;

    @RequestMapping("/getUser")
    public Result<Boolean> getUser(String name) {
        boolean save = userService.save();
        if (!save) {
            throw new LzException("error");
        }
        return new Result(save);
    }

    @RequestMapping("/test2")
    public Result<Object> test2(String name) {
        userService.update();
        return new Result<Object>(true);
    }
    @RequestMapping("/test3")
    public Result<Object> test3(String name) {
        userService.delete();
        return new Result<Object>(true);
    }

}
